<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquicksprite.cpp -->
  <title>Sprite QML 类型 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-qmlmodule.html">QML类型</a></td><td >Sprite QML 类型</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#properties">属性</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Sprite QML 类型</h1>
<span class="subtitle"></span>
<!-- $$$Sprite-brief -->
<p>Specifies sprite animations. <a href="#details">更多...</a></p>
<!-- @@@Sprite -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 导入语句：</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr></table></div><ul>
<li><a href="qml-qtquick-sprite-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">属性</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#duration-prop">duration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#durationVariation-prop">durationVariation</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameCount-prop">frameCount</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameDurationVariation-prop">frameDurationVariation</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameHeight-prop">frameHeight</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameRate-prop">frameRate</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameRateVariation-prop">frameRateVariation</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameSync-prop">frameSync</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameWidth-prop">frameWidth</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameX-prop">frameX</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#frameY-prop">frameY</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#name-prop">name</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#randomStart-prop">randomStart</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#reverse-prop">reverse</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#source-prop">source</a></b></b> : url</li>
<li class="fn"><b><b><a href="qml-qtquick-sprite.html#to-prop">to</a></b></b> : QVariantMap</li>
</ul>
<!-- $$$Sprite-description -->
<a name="details"></a>
<h2 id="details">详细信息</h2>
<p>Sprite defines a series of one or more frames to be animated and rendered by <a href="qml-qtquick-spritesequence.html">SpriteSequence</a>. The sprites can be in the middle of an image file, or split along multiple rows, as long as they form a contiguous line wrapping to the next row of the file from the left edge of the file.</p>
<p>For full details, see the <a href="qtquick-effects-sprites.html">Sprite Animations</a> overview.</p>
<!-- @@@Sprite -->
<h2>属性文档</h2>
<!-- $$$duration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="duration-prop">
<td class="tblQmlPropNode"><p>
<a name="duration-prop"></a><span class="name">duration</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Duration of the animation. Values below 0 are invalid.</p>
<p>If <a href="qml-qtquick-sprite.html#frameRate-prop">frameRate</a> is valid then it will be used to calculate the duration of the frames. If not, and <a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a> is valid, then <a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a> will be used. Otherwise duration is used.</p>
</div></div><!-- @@@duration -->
<br/>
<!-- $$$durationVariation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="durationVariation-prop">
<td class="tblQmlPropNode"><p>
<a name="durationVariation-prop"></a><span class="name">durationVariation</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The duration of the animation can vary by up to this amount. Variation will never decrease the length of the animation to less than 0.</p>
<p>durationVariation will only take effect if duration is used to calculate the duration of frames.</p>
<p>Default is 0.</p>
</div></div><!-- @@@durationVariation -->
<br/>
<!-- $$$frameCount -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameCount-prop">
<td class="tblQmlPropNode"><p>
<a name="frameCount-prop"></a><span class="name">frameCount</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Number of frames in this sprite.</p>
</div></div><!-- @@@frameCount -->
<br/>
<!-- $$$frameDuration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameDuration-prop">
<td class="tblQmlPropNode"><p>
<a name="frameDuration-prop"></a><span class="name">frameDuration</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Duration of each frame of the animation in milliseconds. Values below 0 are invalid.</p>
<p>If <a href="qml-qtquick-sprite.html#frameRate-prop">frameRate</a> is valid then it will be used to calculate the duration of the frames. If not, and frameDuration is valid, then frameDuration will be used. Otherwise duration is used.</p>
</div></div><!-- @@@frameDuration -->
<br/>
<!-- $$$frameDurationVariation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameDurationVariation-prop">
<td class="tblQmlPropNode"><p>
<a name="frameDurationVariation-prop"></a><span class="name">frameDurationVariation</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The duration of a frame in the animation can vary by up to this amount. Variation will never decrease the length of the animation to less than 0.</p>
<p>frameDurationVariation will only take effect if <a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a> is used to calculate the duration of frames.</p>
<p>Default is 0.</p>
</div></div><!-- @@@frameDurationVariation -->
<br/>
<!-- $$$frameHeight -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameHeight-prop">
<td class="tblQmlPropNode"><p>
<a name="frameHeight-prop"></a><span class="name">frameHeight</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Height of a single frame in this sprite.</p>
</div></div><!-- @@@frameHeight -->
<br/>
<!-- $$$frameRate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameRate-prop">
<td class="tblQmlPropNode"><p>
<a name="frameRate-prop"></a><span class="name">frameRate</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Frames per second to show in the animation. Values below 0 are invalid.</p>
<p>If frameRate is valid then it will be used to calculate the duration of the frames. If not, and <a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a> is valid , then <a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a> will be used. Otherwise duration is used.</p>
</div></div><!-- @@@frameRate -->
<br/>
<!-- $$$frameRateVariation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameRateVariation-prop">
<td class="tblQmlPropNode"><p>
<a name="frameRateVariation-prop"></a><span class="name">frameRateVariation</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The frame rate between animations can vary by up to this amount. Variation will never decrease the length of the animation to less than 0.</p>
<p>frameRateVariation will only take effect if <a href="qml-qtquick-sprite.html#frameRate-prop">frameRate</a> is used to calculate the duration of frames.</p>
<p>Default is 0.</p>
</div></div><!-- @@@frameRateVariation -->
<br/>
<!-- $$$frameSync -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameSync-prop">
<td class="tblQmlPropNode"><p>
<a name="frameSync-prop"></a><span class="name">frameSync</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If true, then the animation will have no duration. Instead, the animation will advance one frame each time a frame is rendered to the screen. This synchronizes it with the painting rate as opposed to elapsed time.</p>
<p>If frameSync is set to true, it overrides all of duration, <a href="qml-qtquick-sprite.html#frameRate-prop">frameRate</a> and <a href="qml-qtquick-sprite.html#frameDuration-prop">frameDuration</a>.</p>
<p>Default is false.</p>
</div></div><!-- @@@frameSync -->
<br/>
<!-- $$$frameWidth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameWidth-prop">
<td class="tblQmlPropNode"><p>
<a name="frameWidth-prop"></a><span class="name">frameWidth</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Width of a single frame in this sprite.</p>
</div></div><!-- @@@frameWidth -->
<br/>
<!-- $$$frameX -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameX-prop">
<td class="tblQmlPropNode"><p>
<a name="frameX-prop"></a><span class="name">frameX</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The X coordinate in the image file of the first frame of the sprite.</p>
</div></div><!-- @@@frameX -->
<br/>
<!-- $$$frameY -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameY-prop">
<td class="tblQmlPropNode"><p>
<a name="frameY-prop"></a><span class="name">frameY</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The Y coordinate in the image file of the first frame of the sprite.</p>
</div></div><!-- @@@frameY -->
<br/>
<!-- $$$name -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="name-prop">
<td class="tblQmlPropNode"><p>
<a name="name-prop"></a><span class="name">name</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The name of this sprite, for use in the to property of other sprites.</p>
</div></div><!-- @@@name -->
<br/>
<!-- $$$randomStart -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="randomStart-prop">
<td class="tblQmlPropNode"><p>
<a name="randomStart-prop"></a><span class="name">randomStart</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If true, then the animation will start its first animation with a random amount of its duration skipped. This allows them to not look like they all just started when the animation begins.</p>
<p>This only affects the very first animation played. Transitioning to another animation, or the same animation again, will not trigger this.</p>
<p>Default is false.</p>
</div></div><!-- @@@randomStart -->
<br/>
<!-- $$$reverse -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="reverse-prop">
<td class="tblQmlPropNode"><p>
<a name="reverse-prop"></a><span class="name">reverse</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If true, then the animation will be played in reverse.</p>
<p>Default is false.</p>
</div></div><!-- @@@reverse -->
<br/>
<!-- $$$source -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="source-prop">
<td class="tblQmlPropNode"><p>
<a name="source-prop"></a><span class="name">source</span> : <span class="type"><a href="../qtqml/qml-url.html">url</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The image source for the animation.</p>
<p>If <a href="qml-qtquick-sprite.html#frameHeight-prop">frameHeight</a> and <a href="qml-qtquick-sprite.html#frameWidth-prop">frameWidth</a> are not specified, it is assumed to be a single long row of square frames. Otherwise, it can be multiple contiguous rows or rectangluar frames, when one row runs out the next will be used.</p>
<p>If <a href="qml-qtquick-sprite.html#frameX-prop">frameX</a> and <a href="qml-qtquick-sprite.html#frameY-prop">frameY</a> are specified, the row of frames will be taken with that x/y coordinate as the upper left corner.</p>
</div></div><!-- @@@source -->
<br/>
<!-- $$$to -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="to-prop">
<td class="tblQmlPropNode"><p>
<a name="to-prop"></a><span class="name">to</span> : <span class="type">QVariantMap</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>A list of other sprites and weighted transitions to them, for example {&quot;a&quot;:1, &quot;b&quot;:2, &quot;c&quot;:0} would specify that one-third should transition to sprite &quot;a&quot; when this sprite is done, and two-thirds should transition to sprite &quot;b&quot; when this sprite is done. As the transitions are chosen randomly, these proportions will not be exact. With &quot;c&quot;:0 in the list, no sprites will randomly transition to &quot;c&quot;, but it wll be a valid path if a sprite goal is set.</p>
<p>If no list is specified, or the sum of weights in the list is zero, then the sprite will repeat itself after completing.</p>
</div></div><!-- @@@to -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
